package com.skyjing.astools

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.recyclerview.widget.LinearLayoutManager
import com.skyjing.rvdadapter.MultiItemCommonAdapter
import com.skyjing.rvdadapter.MultiItemTypeSupport
import com.skyjing.askit.LogUtils
import com.skyjing.astools.databinding.ItemTestBinding
import kotlinx.android.synthetic.main.activity_test_recycleview.*

class TestRecycleViewActivity : AppCompatActivity(R.layout.activity_test_recycleview) {
    private val list = ArrayList<String>()

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        initView()
        LogUtils.e("sdfsdfsfsd")
        this.toastNor("9527")
    }

    private fun initView(){
        rv.apply {
            layoutManager = LinearLayoutManager(this@TestRecycleViewActivity)
            adapter = initAdapter()
        }
        rfly.setEnableLoadMore(true)
    }

    private fun initAdapter() : MultiItemCommonAdapter<String, ItemTestBinding> {
        return object : MultiItemCommonAdapter<String , ItemTestBinding>(this ,list ,
            object : MultiItemTypeSupport<String> {
                override fun getLayoutId(itemType: Int): Int {
                    TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
                }

                override fun getItemViewType(position: Int, t: String): Int {
                    TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
//                    when(){
//
//                    }
                }
            }){
            override fun convert(v: ItemTestBinding, t: String, position: Int) {
                TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
            }
        }
    }

//    private fun initAdapter2(param : (context: Context, datas: List<String>) ->Unit): MultiItemCommonAdapter<String , ItemTestBinding>{
//        return object : MultiItemCommonAdapter<String , ItemTestBinding>( ,datas ,
//        object : MultiItemTypeSupport<String>{
//            override fun getLayoutId(itemType: Int): Int {
//                TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
//            }
//
//            override fun getItemViewType(position: Int, t: String): Int {
//                TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
////                    when(){
////
////                    }
//            }
//        }){
//            override fun convert(v: ItemTestBinding, t: String, position: Int) {
//                TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
//            }
//        }
//    }
}